Optimization of Layout DXL (with baseline loop)

Dear Community,

i have the problem, that the following script leads to a "Memory excausted" message when we are performing an excel export via the standard function.

Is there a good hook point in Doors (maybe on View change) that can be used to prefill a string column instead to use Layout DXL here?

In that cases i would be very happy if s.th. like global variables (over all columns) would be available in Doors.

With best regards,
Bjoern

The script is the following:

// DXL generated by DOORS traceability wizard on 07 December 2009.

// Wizard version 2.0, DOORS version 9.2.0.0

pragma runLim, 0

void showIn(Object o, int depth) {
    Link l
    LinkRef lr
    ModName_ otherMod = null
    Module linkMod = null
    ModuleVersion otherVersion = null
    Object othero
    string disp = null
    string s = null
    string s2 = null
    string plain, plainDisp
    int plainTextLen
    int count
    Item linkModItem = itemFromID("4a8aa49d0b7c007e-0000018c")

    if (null linkModItem) {
        displayRich("\\pard " "<<Link module not found>>")
    } else if (type(linkModItem) != "Link") {
        displayRich("\\pard " "<<Invalid link module index for this database>>")
    } else {
        string linkModName = fullName(linkModItem)
        for lr in all(o<-linkModName) do {
            otherMod = module (sourceVersion lr)
            if (!null otherMod) {
                if ((!isDeleted otherMod) && (null data(sourceVersion lr))) {
                    load((sourceVersion lr),false)
                }
            }
        }
        for l in all(o<-linkModName) do {
            otherVersion = sourceVersion l
            otherMod = module(otherVersion)
            if (null otherMod || isDeleted otherMod) continue
            othero = source l
            if (null othero) 
                load(otherVersion,false)
            othero = source l
            if (null othero) continue
            //if (isDeleted othero) continue
      Module bl = null
   AttrDef statAt = null
            s = name(otherMod)
   statAt=find(module(othero),"BB_DocManID")
   if ( statAt != null) {
                s = s ", DDD: " (module(othero))."BB_DocManID" ""
         }
            if (s == "") 
             displayRich("\\pard " " ")
         else
          displayRich("\\pard " s)
   // get last approved baseline
            Module theMod = load(otherVersion, false)
   Baseline b
   string lastApprovedVersion = null
   string stat = null
   Module old = current
   BaselineSet bs = null
   
   int measureStart = (getTickCount_());
   
   for b in theMod do {
    bl = load(b,false)
    statAt = find(bl,"BB_SpecDocStatus")
    if (statAt != null) {
     stat = bl."BB_SpecDocStatus"
//               displayRich("\\pard " stat)
     if (stat == "approved") {
      lastApprovedVersion = (major b) "." (minor b) " "(suffix b) ""
      bs = baselineSet(moduleVersion(bl))
      if (bs != null) {
       lastApprovedVersion = lastApprovedVersion " (BS " versionID(bs) " " annotation(bs) ")"
      }
     }
    }
   }
   
   int measureEnd = (getTickCount_());
   
   displayRich "\nThe doing took " (measureEnd - measureStart) " seconds\n";      
   
   current = old
   if (lastApprovedVersion != null) {
    lastApprovedVersion = "Last approved version: " lastApprovedVersion
   } else {
    lastApprovedVersion = "No approved version exists"
   }
         displayRich("\\pard " lastApprovedVersion )
   // get version string
   b = getMostRecentBaseline(theMod)
   if (b == null) {
    s = "Current version: Current"
   } else {
    s = "Current version: Current " (major b) "." (minor b) " " (suffix b) ""
   }
         // get status
   statAt = find(module(othero),"BB_SpecDocStatus")
   if (statAt != null) {
                stat = (module(othero))."BB_SpecDocStatus"
         }
            s = s " [" stat "]"
            if (s == "") 
             displayRich("\\pard " " ")
            else
             displayRich("\\pard " s)
        }
    }
}

showIn(obj,1)

 


Bjoern_Karpenstein - Wed Aug 27 10:15:34 EDT 2014

Re: Optimization of Layout DXL (with baseline loop)
Tony_Goodman - Wed Aug 27 10:51:46 EDT 2014

You need to use Attribute DXL instead of Layout DXL, that will improve performance.

The easiest way to do this is to convert the layout DXL column to DXL attribute.

Menu option is the last option under Toolls > Support Tools

Re: Optimization of Layout DXL (with baseline loop)
llandale - Wed Aug 27 16:03:51 EDT 2014

Yes, Layouts refresh every time the module screen changes (including moving another window over it), perhaps 10 times per second.  All complicated DXL does vastly better as Attr-DXL, which runs only once.

Do you realize your code opens up all in-linked partner modules and all those modules' baselines?  Am guessing that is where your memory is going.

Seems to me your Baseline loop will always produce the same results for an object, since baselines don' change.  Perhaps have an on-demand script that finds your "lastApprovedVersion" and updates a string attribute with that value; and closes the baselines.  Then your code above just reads the value instead of plowing through all the baselines each time.

-Louie